<?php
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../Mqtt.php';

$mqtt = new Mqtt;
$mqtt->createChannel();

$queueName = "topic-queue1";
$exchangeName = 'topic-exchange';
$mqtt->createExchange($exchangeName, 'topic');
$mqtt->createQueue($queueName);

$routerKeys = ['ack.ok'];
foreach($routerKeys as $routerKey) {
    $mqtt->bindQueueAndExchange($queueName, $exchangeName, $routerKey);
}

$mqtt->consumeMsg(function($msg){
    echo $msg . PHP_EOL;
});

$mqtt->close();
